package com.hippo.core.controller;

import com.alibaba.fastjson.JSONObject;
import com.hippo.core.config.annotation.RequiresPermissions;
import com.hippo.core.service.DingTalkConfigService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @author: hippo
 */
@RestController
public class DingTalkConfigController {

    @Autowired
    private DingTalkConfigService dingTalkConfigService;

    @RequiresPermissions("dingTalkConfig:list")
    @PostMapping("/getDingTalkConfigList")
    public JSONObject getDingTalkConfigList(@RequestBody JSONObject data) {
        return dingTalkConfigService.getDingTalkConfigList(data);
    }

    @RequiresPermissions("dingTalkConfig:add")
    @PostMapping("/addDingTalkConfig")
    public JSONObject addDingTalkConfig(@RequestBody JSONObject data) {
        return dingTalkConfigService.addDingTalkConfig(data);
    }

    @RequiresPermissions("dingTalkConfig:delete")
    @DeleteMapping("/deleteDingTalkConfig/{id}")
    public JSONObject deleteDingTalkConfig(@PathVariable String id) {
        return dingTalkConfigService.deleteDingTalkConfig(id);
    }

    @RequiresPermissions("dingTalkConfig:update")
    @PutMapping("updateDingTalkConfig")
    public JSONObject updateDingTalkConfig(@RequestBody JSONObject data) {
        return dingTalkConfigService.updateDingTalkConfig(data);
    }
}
